package com.tcu.mosaicdemo;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by chenlong on 15/8/20.
 */
public class MosaicActivty extends AppCompatActivity{
    public static final String INTENT_PATH_LIST = "_intent_path_list";
    private Button mSaveButton;
    private MosaicView mMosaicView;
    private List<String> mPathList;
    public static void navToMosaicActivity(Context context,ArrayList<String> pathList){
        Intent intent = new Intent(context,MosaicActivty.class);
        intent.putExtra(INTENT_PATH_LIST,pathList);
        context.startActivity(intent);
    }
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_mosaic);
        if(getIntent().hasExtra(INTENT_PATH_LIST)){
            mPathList = (ArrayList<String>)getIntent().getSerializableExtra(INTENT_PATH_LIST);
        }
        mMosaicView = (MosaicView)findViewById(R.id.mosaicview);
        if(mPathList!=null && mPathList.size()>0){
            //TODO init mosaicView
            mMosaicView.setPathList(mPathList);
        }
        mSaveButton = (Button)findViewById(R.id.save_btn);
        mSaveButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                //TODO save image
            }
        });

    }
}
